<template>
  <div class="addMerchant">
    <div class="merchant-info">
        <ul>
                <!-- <li>
                    <span>营业时间</span>
                    <span>{{merchantsData.businessTime}}</span>
                </li> -->
                <li>
                    <span>身份证反面</span>
                    <img v-if="merchantsData.cardEnd" :src="merchantsData.cardEnd" alt="">
                    <!-- <span>{{merchantsData.cardEnd}}</span> -->
                </li>
                <li>
                    <span>身份证正面</span>
                    <img v-if="merchantsData.cardFront" :src="merchantsData.cardFront" alt="">
                    <!-- <span>{{merchantsData.cardFront}}</span> -->
                </li>
                <li>
                    <span>站点负责人</span>
                    <span>{{merchantsData.chargePersonName}}</span>
                </li>
                <li>
                    <span>负责人电话</span>
                    <span>{{merchantsData.chargePersonPhone}}</span>
                </li>
                <!-- <li>
                    <span>入驻状态</span>
                    <span v-if="merchantsData.checkState==0">待审核</span>
                    <span v-if="merchantsData.checkState==1">同意入驻</span>
                    <span v-if="merchantsData.checkState==2">拒绝入驻</span>
                </li> -->
                <li>
                    <span>创建时间</span>
                    <span>{{merchantsData.createTime}}</span>
                </li>
                <li>
                    <span>冷藏设备图片</span>
                    <img v-if="merchantsData.equipmentImage" :src="merchantsData.equipmentImage" alt="">
                </li>
                <li>
                    <span>营业执照图片</span>
                    <img v-if="merchantsData.licenseImage" :src="merchantsData.licenseImage" alt="">
                </li>
                <li>
                    <span>站点地址纬度</span>
                    <span>{{merchantsData.lat}}</span>
                </li>
                <li>
                    <span>站点地址经度</span>
                    <span>{{merchantsData.lng}}</span>
                </li>
                <li>
                    <span>邀请码</span>
                    <span>{{merchantsData.invitationCode}}</span>
                </li>
                <li>
                    <span>地址</span>
                    <span>{{merchantsData.shopAdressProvince}} {{merchantsData.shopAdressCity}} {{merchantsData.shopAdressDetail}} {{merchantsData.shopAdress}}</span>
                </li>
                <li>
                    <span>站点logo</span>
                    <span><img v-if="merchantsData.shopLogo" :src="merchantsData.shopLogo" align="middle" alt=""></span>
                </li>
                <!-- <li>
                    <span>简介</span>
                    <span>{{merchantsData.siteBrief}}</span>
                </li> -->
                <li>
                    <span>自提点图片</span>
                    <span><img :src="merchantsData.siteImage" align="middle" alt=""></span>
                </li>
                <li>
                    <span>站点名称</span>
                    <span>{{merchantsData.siteName}}</span>
                </li>
                 <li>
                    <span>站点账号</span>
                    <span>{{merchantsData.sitePhone}}</span>
                </li>
                  <!-- <li>
                    <span>是否启用</span>
                    <span>{{merchantsData.state==1?'启用':'禁用'}}</span>
                </li> -->
                <li class="item" v-show="number !== '4'">
                    <span>是否审核通过</span>
                    <div>
                        <template>
                            <el-radio v-model="checkState" :label="1" :disabled="this.number == 1 ? false : true">通过</el-radio>
                            <el-radio v-model="checkState" :label="2" :disabled="this.number == 1 ? false : true">不通过</el-radio>
                        </template>
                    </div>
                </li>
                <li v-show="number == 1 && checkState == 2">
                    <span>拒绝原因</span>
                    <span>
                      <el-input
                        maxlength="200"
                        resize="none"
                        placeholder="请输入详细地址"
                        type="textarea"
                        :rows="3"
                        v-model="content"
                      ></el-input>
                    </span>
                </li>
            </ul>    
        <div class="content-bottom" style="margin:50px 0 0 120px;">
            <el-button type="primary" @click="adad">确定</el-button>
            <el-button type="warning"  @click="cancelClick">取消</el-button>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      fileList:[],
      merchantsData:'',
      checkState: '',
      content:'',
      searchoptions1: [
        //是否缴纳保证金
        { label: "未缴纳", value: 0 },
        { label: "已缴纳", value: 1 },
      ],
      paymentAccount: [
        // 缴费账号
        { label: "支付宝", value: 1 },
        { label: "微信", value: 2 },
        { label: "银行卡", value: 3 },
      ],
      merchantsData:'',
      radioValue:'1',
      number:'',
      siteId:'',
    };
  },
  mounted() {
    this.loadShopList()
  },
  watch:{
    
  },
  components:{

  },
  computed:{

  },
  methods: {
    // 取消
    cancelClick() {
      this.$router.push("/index/afresidence");
    },
    loadShopList(){
      this.number = this.$route.query.number
      this.siteId = this.$route.query.siteId
      var param={
          siteId:this.$route.query.siteId,
      }
      this.axios({
          url:'/site/getById',
          method:'post',
          data:JSON.stringify(param),
      }).then(res=>{
          this.merchantsData=res.data.data
          this.checkState = this.merchantsData.checkState
      })
    },

    // 提交
    adad() {
      var Obj={
        siteId:this.$route.query.siteId,
        checkState:this.checkState,
        content:this.content,
      }
      this.axios({
        url: "/site/updateCheckState",
        method: "post",
        data:Obj,
      }).then((res) => {
        //处理异常
        if (res.data.code =='') {
          this.$message({
            message: '提交成功',
            type: 'success'
          });
          if(this.number == 1 && this.checkState == 1) {
            console.log("通过")
            var param = {
              siteId:this.siteId,
              state: 1,
            };
            this.axios({
              url: "/site/updateState",
              method: "post",
              data: JSON.stringify(param),
            }).then((res) => {
              
            });
          }else if(this.number == 1 && this.checkState == 2) {
            console.log("拒绝")
            var param = {
              siteId:this.siteId,
              state: 0,
            };
            this.axios({
              url: "/site/updateState",
              method: "post",
              data: JSON.stringify(param),
            }).then((res) => {
              
            });
          }
          this.$router.push({
          path:'/index/afresidence',
        })
        }
      });
    },
  },
  watch: {},
};
</script>

<style scoped>
.addMerchant {
  position: relative;
}
.merchant-info{
    margin-top:50px;
}
.merchant-info ul li {
  margin-top: 15px;
  display: flex;
  align-items: center;
}
.merchant-info ul li span:first-child {
  display: inline-block;
  margin-right: 20px;
  width: 120px;
  text-align: right;
}

#go-back {
  width: 60px;
  padding: 7px;
  text-align: center;
  margin-left: 64px;
}
/* 合同状态 */
label input {
  height: 12px;
}

/* 上传按钮 */
.upload-demo {
  display: inline-block;
}
.my-btn:hover {
  cursor: pointer;
}
img{
  height: 148px;
}
</style>